package com.tc.biz.service.impl;


import com.tc.activiti.util.BeanUtils;
import com.tc.biz.entity.BpmnCopyProcess;
import com.tc.biz.entity.SysUser;
import com.tc.biz.mapper.BpmnCopyProcessMapper;
import com.tc.biz.service.BpmnCopyProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BpmnCopyProcessServiceImpl implements BpmnCopyProcessService {

    @Autowired
    private BpmnCopyProcessMapper bpmnCopyProcessMapper;

    @Override
    public int deleteByPrimaryKey(String id) {
        return bpmnCopyProcessMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(BpmnCopyProcess record) {
        return bpmnCopyProcessMapper.insert(record);
    }

    @Override
    public int insertSelective(BpmnCopyProcess record) {
        return bpmnCopyProcessMapper.insertSelective(record);
    }

    @Override
    public BpmnCopyProcess selectByPrimaryKey(String id) {
        return bpmnCopyProcessMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(BpmnCopyProcess record) {
        return bpmnCopyProcessMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(BpmnCopyProcess record) {
        return bpmnCopyProcessMapper.updateByPrimaryKey(record);
    }

    @Override
    public void batchInsert(List<BpmnCopyProcess> list) {
        if (BeanUtils.isNotEmpty(list)) {
            for (BpmnCopyProcess bpmnCopyProcess : list) {
                bpmnCopyProcessMapper.insert(bpmnCopyProcess);
            }
        }
    }

    @Override
    public List<BpmnCopyProcess> findByUserId(String userId) {
        return bpmnCopyProcessMapper.findByUserId(userId);
    }

    @Override
    public List<String> findReceiverByProceInstanceId(String processInstanceId) {
        return bpmnCopyProcessMapper.findReceiverByProceInstanceId(processInstanceId);
    }
}